package com.power.poi.excel;

import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Workbook;

/**
 * @author sunyu
 */
public class ExcelExportFontStyle {
    private static final String FONT_NAME = "宋体";

    /**
     * create excel header font
     * @param workbook Workbook
     * @return Font
     */
    public static Font getHeaderFont(Workbook workbook) {
        Font font = workbook.createFont();
        font.setFontName(FONT_NAME);
        font.setBold(true);
        font.setFontHeight((short) 250);
        font.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
        return font;
    }

    /**
     * create excel title font
     * @param workbook Workbook
     * @return Font
     */
    public static Font getTitleFont(Workbook workbook) {
        Font font = workbook.createFont();
        font.setFontName(FONT_NAME);
        // font.setBoldweight((short) 100);
        // font.setFontHeight((short) 250);
        font.setFontHeightInPoints((short) 10);
        font.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
        font.setBold(true);
        return font;
    }
}
